<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
  <head>
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2010. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
    <link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css">
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <title>
      Creating your first Java project
    </title>
    <script language="JavaScript" type="text/javascript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js"> </script>
  </head>
  <body>
    <h1>
      Creating your first Java project
    </h1>
    <p>
      In this section, you will create a new Java project. You will be using
      JUnit as your example project. JUnit is an open source unit testing framework for Java.
    </p>
<H2>Getting the Sample Code (JUnit)</H2>


<P>First you need to download the JUnit source code.</P>
<OL>
	<LI>Click <A href="http://www.eclipse.org/jdt/ui/smoke-test/junit3.8.1src.zip">here</A> to download the JUnit source code.</LI>
	<LI>Save the archive (do not extract) to a directory from now on referenced as <em>&lt;Downloads&gt;</em>.</LI>
	</OL>
<H2>Creating the project</H2>

<OL>

	<LI>Inside Eclipse select the menu item <STRONG>File &gt; New &gt;
	Project...</STRONG>. to open the <STRONG>New Project</STRONG> wizard
	</LI>
	<LI>Select <STRONG>Java Project</STRONG> then click <STRONG>Next</STRONG> 
	to start the
	<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.newWizard(newWizardId=org.eclipse.jdt.ui.wizards.JavaProjectWizard)")'>
	<img src="PLUGINS_ROOT/org.eclipse.help/command_link.svg" alt="Open the new Java project wizard">
	<STRONG>New Java Project</STRONG></a> wizard:
	<P><img src="images/wiz_new_project.png"  alt="New Java Project wizard"></P>
	On this page,
	<UL>
	  <LI>type &quot;JUnit&quot; in the <STRONG>Project name</STRONG> field, and</LI>
	  <LI>select &quot;J2SE-1.4&quot; in the <STRONG>Use an execution environment JRE</STRONG> field.</LI>
	</UL>
	Then click <STRONG>Finish</STRONG>. 
	</LI>
	<LI>In the Package Explorer, expand the <EM>JUnit</EM> project and
	select the source folder <EM>src</EM>.</LI>
	<LI>Select the menu item <STRONG>File &gt; Import...</STRONG>.</LI>
	<LI>Expand <STRONG>General</STRONG>, select <STRONG>Archive file</STRONG>, and click <STRONG>Next</STRONG>.
	</LI>
	<LI>Click the <STRONG>Browse</STRONG> button next to the <STRONG>Archive
	file</STRONG> field and browse to select
	<p><em>&lt;Downloads&gt;/junit381src.jar</em></p>
	<STRONG>Note:</STRONG> This step assumes that you followed steps 1 and 2 in the <STRONG>Getting
	the Sample Code</STRONG> section above.<BR>
	</LI>
	<LI>In the Import wizard, expand the root node, press <STRONG>Deselect All</STRONG> and select only the <STRONG>junit</STRONG> node.
	You can expand and select elements within the <EM>junit</EM>
	directory on the left pane to view the individual resources that you
	are importing on the right pane. <EM>Note: Do not deselect any of the
	resources in the junit directory at this time. You will need all
	of these resources in the tutorial.</EM>
	<P><img src="images/wiz_import_arch.png"  alt="Import archive wizard">
</P>
	</LI>
	<LI>Make sure that the JUnit project's source folder appears in the destination <STRONG>Into folder</STRONG>
	field. Then click <STRONG>Finish</STRONG>. In the import progress
	indicator, notice that the imported resources are compiled as they are
	imported into the workbench. This is because the <STRONG>Build
	automatically</STRONG> option is checked on the Workbench preferences
	page.</LI>
	<LI>In the Package Explorer view, expand the JUnit project and the src folder to view the
	JUnit packages.
	<P><img src="images/view_package_explorer_junit.png"  alt="Package Explorer"></P>
	</LI>
</OL>
<P class="nav_footer" id="nav_footer">Next Section: <A href="qs-4.htm">Browsing Java elements using the package explorer</A>
</P>
    <h3 class="related">Related concepts</h3>
      <a href="../concepts/concept-java-project.htm">Java projects</a><br>
      <a href="../concepts/concept-java-views.htm">Java views</a>
    <h3 class="related">Related references</h3>
      <a href="../reference/ref-wizard-java-project.htm">New Java Project Wizard</a><br>
      <a href="../reference/views/ref-view-package-explorer.htm">Package Explorer View</a>
  </body>
</html>

